package com.jkhan.common.exception;

import com.jkhan.common.result.ResponseEnum;
import lombok.Data;
import lombok.ToString;

/**
 * @ClassName BusinessException
 * @Description
 * @Author hjk
 * @date 2023/3/4 16:50
 * @Version 1.0
 */
@Data
@ToString
public class BusinessException extends RuntimeException {

    private final Integer code;
    private final String msg;

    public BusinessException(Integer code, String msg) {
        super(msg);
        this.code = code;
        this.msg = msg;
    }

    public BusinessException(ResponseEnum result) {
        super(result.getMsg());
        this.code = result.getCode();
        this.msg = result.getMsg();
    }

}
